package web.common.core.io;

import lombok.Getter;
import lombok.Setter;

import java.util.Set;

/**
 * @author Jin Zheng
 * @since 1.0 2022-01-07
 */
@Getter
@Setter
public class StorageOptions {
	private static final Set<String> HASH_TYPE = Set.of("SHA-1", "SHA-256");

	private String type;
	private String rootPath;
	private String hashType;

	public StorageOptions() {
	}

	public void check() {
		if (hashType != null && hashType.isEmpty() && !HASH_TYPE.contains(hashType)) {
			throw new IllegalArgumentException("hash-type only support: {}" + HASH_TYPE);
		}
	}

}
